#ifndef CONFMANAGER_H_
#define CONFMANAGER_H_

#include "Common.h"
#include "Configure.h"

class Server
{
    public:
        Server():ip(""),port(0){}

        std::string ip;
        int32 port;
};

class Group
{
    public:
        Group():sCnt(0),server(NULL){}

        int32 sCnt;
        Server *server;
};

class Terminal
{
    public:
        Terminal():gCnt(0),group(NULL){}

        int32 gCnt;
        Group *group;
};

class ConfManager
{
    private:

        ConfManager(std::string confFile);

        bool _GetIPPort(std::string ipPort, std::string &ip, int32 &port);

        static ConfManager *_instance;

        static pthread_mutex_t _mutex;

        int32 _listenPort;

        int32 _workThreadCnt;

        int32 _socketPoolSize;

        int32 _socketAccpetSize;

        int32 _epollTimeOut;

        int32 _keepAlive;

        int32 _readTimeOut;

        int32 _writeTimeOut;

        int32 _isDispatcher;

        int32 _retryTime;

        Terminal _terminal;

    public:

        ~ConfManager();

        static ConfManager *Instance();

        int32 GetListenPort();

        int32 GetWorkThreadCnt();

        int32 GetSocketPollSize();

        int32 GetSocketAcceptSize();

        int32 GetEpollTimeOut();

        int32 GetKeepAlive();

        int32 GetReadTimeOut();

        int32 GetWriteTimeOut();

        int32 GetIsDispatcher();

        int32 GetRetryTime();

        Terminal GetTerminal();

};

#endif
